<#include "/includes/son.ftl">

<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">

            <div class="card">
                <div class="card-toolbar clearfix">
                    <div class="toolbar-btn-action">
                        <a class="btn btn-primary m-r-5" id="addBtn" href="#!"><i class="mdi mdi-plus"></i> 新增</a>
                    </div>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>菜单名称</th>
                                <th>菜单地址</th>
                                <th>上级菜单</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <#list menuPage.records as ip>
                                <tr>
                                    <td>${ip.id}</td>
                                    <td>${ip.menuName}</td>
                                    <td>${ip.menuHref}</td>
                                    <td>${ip.sMenuName.menuName}</td>
                                    <td>
                                        <div class="btn-group">
                                            <a id="${ip.id}" class="btn btn-xs btn-default ediBtn" href="#!" title="" data-toggle="tooltip" data-original-title="编辑"><i class="mdi mdi-pencil"></i></a>
                                            <a id="${ip.id}" class="btn btn-xs btn-default delBtn" href="#!" title="" data-toggle="tooltip" data-original-title="删除"><i class="mdi mdi-window-close"></i></a>
                                        </div>
                                    </td>
                                </tr>
                            </#list>
                            </tbody>
                        </table>
                        <ul id="pagination1" class="pagination"></ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    var pageTotal='<#if menuPage.total??>${menuPage.total}</#if>'==''?1:${menuPage.total};
    var pageSize='<#if menuPage.size??>${menuPage.size}</#if>'==''?10:${menuPage.size};
    var currentPage='<#if menuPage.current??>${menuPage.current}</#if>'==''?1:${menuPage.current};
    showPage(pageTotal,pageSize,currentPage);
</script>

<script>
    $("#addBtn").click(function (){
        window.location.href = "/sys/sysMenu/MenuEdit"
    })
    $(".ediBtn").click(function (){
        window.location.href = "/sys/sysMenu/MenuEdit?id="+this.id

    })
    $(".delBtn").click(function (){
        $.post("/sys/sysMenu/menuDel",{id:this.id},function (res){
            lightyear.notify(res.data, 'success', 5000, 'mdi mdi-emoticon-happy', 'top', 'center');
        })
        window.location.href = "/sys/sysMenu/MenuList";
    })
</script>